package com.smh.a03ExercisesDemo1;

import java.util.*;

public class Test4 {
    public static void main(String[] args) {
        //省和市

        ArrayList<String> city1 = new ArrayList<>();
        Collections.addAll(city1,"1","2","3","4");
        ArrayList<String> city2 = new ArrayList<>();
        Collections.addAll(city2,"4","5","6","7");
        ArrayList<String> city3 = new ArrayList<>();
        Collections.addAll(city3,"8","9","1","1");

        HashMap<String,ArrayList<String>> hm = new HashMap<>();
        hm.put("asd",city1);
        hm.put("qwe",city2);
        hm.put("zxc",city3);

        Set<Map.Entry<String, ArrayList<String>>> entries = hm.entrySet();
        for (Map.Entry<String, ArrayList<String>> entry : entries) {
            System.out.print(entry.getKey()+"=");
            ArrayList<String> arrayList = entry.getValue();
            StringJoiner sj = new StringJoiner(",");
            for (String s : arrayList) {
                sj.add(s);
            }
            System.out.println(sj);
        }


    }
}
